import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/system/user/login',
    method: 'post',
    data
  })
}

export function saveRolesByUserId(data) {
  return request({
    url: '/system/user/saveRolesByUserId',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/system/user/info',
    method: 'get',
    params: { token }
  })
}

export function deleteById(id) {
  return request({
    url: '/system/user/delete',
    method: 'get',
    params: { id }
  })
}

export function insert(data) {
  return request({
    url: '/system/user/insert',
    method: 'post',
    data
  })
}

export function deleteRoleIdByUserId(userId,roleId) {
  return request({
    url: '/system/user/deleteRoleIdByUserId',
    method: 'get',
    params: { userId:userId, roleId:roleId}
  })
}

// export function getList(token) {
//   return request({
//     url: '/system/user/list',
//     method: 'get'
//   })
// }

export function getList(data) {
  return request({
    url: '/system/user/getList',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/system/user/logout',
    method: 'get'
  })
}

export function exportWps() {
  return request({
    url: '/user/exportWps',
    method: 'get'
  })
}

export function getRightUserList() {
  return request({
    url: '/system/user/getRightUserList',
    method: 'get'
  })
}
export function avatarUp() {
  return request({
    url: '/system/user/avatar',
    method: 'get'
  })
}